package com.sk.restree.model.action;

import java.io.IOException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.sk.restree.model.dao.StatusDAO;
import com.sk.restree.model.dto.MemberDTO;

public class UseBenefitStore implements Action {

	@Override
	public Object execute(HttpServletRequest request,
			HttpServletResponse response) {
		String name = request.getParameter("name");
		String store_id = request.getParameter("storeid");
		HttpSession session = request.getSession();
		MemberDTO memberDTO = (MemberDTO) session.getAttribute("userinfo");
		if (memberDTO == null)
			return null;
		
		StatusDAO dao = StatusDAO.getInstance();
		dao.insertBenefitStatus(memberDTO.getMember_id(),name, store_id);
		try {
			response.getWriter().println(true);
		} catch (IOException e) {
			e.printStackTrace();
		}
		return null;
	}

}
